﻿@model ImportModel
@{
    Layout = null;
}
    <form id="startingForm" action="/@app.OrganizationUniqueName/dataimport/starting" method="post" enctype="multipart/form-data">
        @Html.HiddenFor(x => x.EntityId)
        @Html.HiddenFor(x => x.EntityName)
        @Html.HiddenFor(x => x.ImportFileId)
        @Html.HiddenFor(x => x.ImportMapId)
        @Html.HiddenFor(x => x.DataFileName)
        @Html.HiddenFor(x => x.ParentId)
        @Html.HiddenFor(x => x.ParententityName)
        @Html.HiddenFor(x => x.SessionId)
        <div class="form-group">
            <label>记录类型</label>
            <div>
                @Model.EntityName
            </div>
        </div>
        <div class="form-group">
            <label>重复数据</label>
            <div>
                <select class="form-control" disabled>
                    @if (Model.DuplicateDetection == 1)
                    {
                        <option value="1">不导入</option>
                    }
                    else if (Model.DuplicateDetection == 2)
                    {
                        <option value="2">覆盖导入</option>
                    }
                    else if (Model.DuplicateDetection == 3)
                    {
                        <option value="3">不导入新数据，仅覆盖重复数据</option>
                    }
                </select>
            </div>
        </div>
        <div class="form-group">
            <label>数据文件</label>
            <div>
                @Model.DataFileName
            </div>
        </div>
        <div class="form-group hide">
            <label>导入完成</label>
            <div class="importresult">
                成功0，失败1，<a style="padding-left:10px;" class="text-primary" href="javascript:entityIframe(true,\" \")">查看详情</a>
            </div>
        </div>
    </form>
<!-- （Modal） -->
@*<div class="modal fade" id="importModal" tabindex="-1" role="dialog"
         aria-labelledby="importModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div id="importconfirm-body" class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"
                            aria-hidden="true">
                        ×
                    </button>
                    <h4 class="modal-title" id="navGroupModalLabel">
                        确认导入数据
                    </h4>
                </div>
                <div class="modal-body">
                    <form id="startingForm" action="/@app.OrganizationUniqueName/dataimport/starting" method="post" enctype="multipart/form-data">
                        @Html.HiddenFor(x => x.EntityId)
                        @Html.HiddenFor(x => x.EntityName)
                        @Html.HiddenFor(x => x.ImportFileId)
                        @Html.HiddenFor(x => x.ImportMapId)
                        @Html.HiddenFor(x => x.DataFileName)
                        <div class="form-group">
                            <label>记录类型</label>
                            <div>
                                @Model.EntityName
                            </div>
                        </div>
                        <div class="form-group">
                            <label>重复数据</label>
                            <div>
                                <select class="form-control" disabled>
                                    @if (Model.DuplicateDetection == 1)
                                    {
                                        <option value="1">不导入</option>
                                    }
                                    else if (Model.DuplicateDetection == 2)
                                    {
                                        <option value="2">覆盖导入</option>
                                    }
                                    else if (Model.DuplicateDetection == 3)
                                    {
                                        <option value="3">不导入新数据，仅覆盖重复数据</option>
                                    }
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label>数据文件</label>
                            <div>
                                @Model.DataFileName
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="importresult">
                                导入完成：成功0，失败1，<a href="javascript:entityIframe(true,\"\")">查看详情</a>
                            </div>
                        </div>
                    </form>
                    <script src="/content/js/jquery.form.js?v=@app.PlatformSettings.VersionNumber"></script>
                    <script>
                        var ImportConfirmModel = {
                            dialogid: '#importModal',
                            dialog: $('#importModal'),
                            submit: function () {
                                $('#startingForm').ajaxSubmit(function (response) {
                                    console.log(response);
                                    if (response.IsSuccess) {
                                        var d = JSON.parse(response.Content);
                                        //mzg.Web.Toast(d.successcount + '条成功，' + d.failurecount + '条失败', response.IsSuccess);
                                        $('.importresult').append('导入完成：' + d.successcount + '条成功，' + d.failurecount + '条失败');
                                        $('.importresult').append('<a href="javascript:entityIframe(true,\"/entity/create?recordid=' + d.importfileid + '\")">查看详情</a>');
                                        //ImportConfirmModel.dialog.modal('hide');
                                        return;
                                    }
                                    Dlv.web.Alert(response.IsSuccess, response.Content);
                                });
                            }
                        };
                        $(function () {
                            ImportConfirmModel.dialog.modal({
                                backdrop: 'static'
                            });
                            ImportConfirmModel.dialog.on('hidden.bs.modal', function () {
                                Dlv.web.CloseDialog(ImportConfirmModel.dialogid);
                            });
                            $(ImportConfirmModel.dialogid + ' button[name=submitBtn]').off('click').on('click', null, function (e) {
                                ImportConfirmModel.submit();
                                Dlv.web.CloseDialog(ImportConfirmModel.dialogid);
                            });
                        });
                    </script>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">
                        <span class="glyphicon glyphicon-remove"></span> 取消
                    </button>
                    <button type="button" class="btn btn-primary" name="submitBtn">
                        <span class="glyphicon glyphicon-ok"></span> 确认导入
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal-dialog -->
    </div>*@
<!-- /.modal -->